// 开发文档: https://uniapp.dcloud.net.cn/uniCloud/cloud-obj
module.exports = {
	async get() {
		const db = uniCloud.database()
		const res = await db.collection("annunciate").get()
		return res
	},
	async add(val) {
		const db = uniCloud.database()
		const result = await db.collection("annunciate").get()
		if (result.data.length > 0) {
			const res = await db.collection("annunciate").where({
				annunciate: result.data[0].annunciate
			}).update({
				annunciate: val
			})
			return res
		} else {
			const res = await db.collection("annunciate").add({
				annunciate: val
			})
			return res
		}
	}
}
